package com.xm;

/**
 * @Author：xm
 * @Project：runoob
 * @Date：2024/10/12 19:58
 */

// “FizzBuzz问题”
public class FizzBuzz2 {
    public static void main(String[] args) {

        for (int i = 1; i <= 100; i++) {
            String result = test(i);
            System.out.println("result = " + result);
        }
    }

    public static String test(int num) {

        if (num % 3 == 0 && num % 5 == 0) {
            return "FizzBuzz";
        }
        if (num % 3 == 0) {
            return "Fizz";
        }
        if (num % 5 == 0) {
            return "Buzz";
        }
        return String.valueOf(num);
    }
}
